<?php
/**
 * Created by PhpStorm.
 * User: jswei
 * Date: 2018/4/24
 * Time: 8:54
 */

namespace app\admin\model;

class Member extends Base {

    public function getOneById($id = 0, $field = '*'){
        $info = $this
            ->field($field)
            ->with('admin')
            ->find($id);
        return $info;
    }

    public function add($data){
        $this->save($data);
    }

    public function admin(){
        return $this->hasOne('Admin','id','aid')
            ->bind([
                'username',
                'nickname'
            ]);
    }
}